<template>
  <div>
    <mt-header title="就诊人管理" style="background-color: white; color: black">
      <div @click="goAdd" slot="left">
        <mt-button icon="back" style="color: black"></mt-button>
      </div>
    </mt-header>

    <!-- 判断是否有就诊人 -->
    <div class="aboutContent" v-if="tabIndex">
      <div class="logText">
        <div class="logoBox">
          <img
            class="logoimg"
            src="../../assets/imageW/noIcon.png"
            mode="widthFix"
            alt=""
          />
        </div>

        <div class="aboutText">暂时还没有就诊人！！！</div>
      </div>

      <div class="buttonBox" @click="addPatient">
        <div class="addBox">
          <img class="addIcon" src="../../assets/imageW/addIcon.png" />
          <div class="addText">新增旧赠人</div>
        </div>
      </div>
    </div>
    <!-- 有就诊人信息 -->
    <div class="patientList" v-if="!tabIndex">
      <div class="patList" v-for="(item,index) in List" :key="index">
        <div class="nameBox">
          <div class="nameText">{{item.mname}}</div>
          <div class="pahoneBox">
            <div class="phoneText">手机号</div>
             <div class="numText">{{item.ID_card}}</div>
          </div>
        </div>
      
      <div class="cardPost">证件号</div>
      <div class="postNum">{{item.phone}}</div>
    

      </div>

      <!-- 添加 -->
      <div class="addBox" @click="addPatient">
        <img class="addIcon" src="../../assets/imageW/addIcon.png" alt="">
        <div class="add">新增就诊人</div>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      tabIndex: true,
      List:[],

    }
  },
  methods:{
    addPatient(){
        this.$router.push('./patientAdd')
    },
    goAdd(){
      this.$router.push('/index/my')
    }
  },
  mounted() {
    this.axios.get(`/users/one_reg?id=${this.$store.state.phone}`).then((res)=>{
      this.tabIndex = false
      this.List = res.data.data
     
    });
  },
};
</script>

<style lang="scss" scoped>
.aboutContent {
  padding: 1vh 3vh;
  box-sizing: border-box;
}
.logText {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.logoBox {
  width: 180px;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  margin: 80px auto 10px;
}
.logoimg {
  width: 180px;
  height: 220px;
}
.logoimg image {
  width: 100%;
}
.aboutText {
  text-align: center;
  color: black;
  letter-spacing: 2px;
  line-height: 38px;
  font-weight: 500;
}
.buttonBox {
  border-radius: 12px;
  background-color: #00d4b8;
  height: 100px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  left: 0;
  bottom:0;
}
.patientList{
  padding: 2vh;
  box-sizing: border-box;
}
.addBox {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.addText {
  margin-top: 5px;
  color: white;
}
.addIcon {
  width: 24px;
  height: 24px;
  border-radius: 48px;
}
.addIcon image {
  width: 100%;
}
.patList{
  padding: 10px;
  box-sizing: border-box;
  background-color: #E5FFFB;
  margin-bottom: 10px;
  border-radius: 12px;
}
.nameBox{
  display: flex;
  align-content: center;
  justify-content: space-between;
}
.nameText{
  font-weight: 600;
  font-size: 20px;
}
.phoneText{
  font-size: 14px;
}
.cardPost{
  margin-top: 10px;
  font-size: 14px;
}
.pahoneBox{
  display: flex;
}
.postNum{
  margin-top: 10px;
  font-size: 14px;
}
.addBox{
  display: flex;
  justify-content: center;
  align-content: center;
  border-radius: 12px;
  padding: 20px 0 ;
  border: 2px  dashed #00D4B8 ;
}
.addIcon{
  width: 38px;
  height: 38px;
.add{
  margin-top: 4px;

}
}



</style>